/*
============================================================================
 Name        : BlockZXGManage.h
 Author      : \xD5\x{017c}\xD2\xE7\xE2
 Version     :
 Copyright   : Your copyright notice
 Description : \xD7\xD4\x{0461}\xB9\x{0279}\xDC\xC0\xED\xBD\xE7\xC3\xE6
============================================================================
*/

#ifndef BLOCKZXGMANAGE_H
#define BLOCKZXGMANAGE_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "Block.h"

// CLASS DECLARATION

class CSingleLineTextInput;

/**
*  CBlockZXGManage
* 
*/
class CBlockZXGManage : public CBlock
{
public: // Constructors and destructor
	~CBlockZXGManage();
	static CBlockZXGManage* NewL(CBaseBlock* bsBack, RArray<TGoodsName>& aModifiedZXG);
	static CBlockZXGManage* NewLC(CBaseBlock* bsBack, RArray<TGoodsName>& aModifiedZXG);

private:
	CBlockZXGManage(CBaseBlock* bsBack, RArray<TGoodsName>& aModifiedZXG);
	void ConstructL();

public:
	void OnDraw(CFbsBitGc& g) const;
	void OnKeyEvent(const TInt& keyCode);
	void SizeChanged();
	void OnMouseUp(const TPoint& aPt);
	TBool OnMenuEvent(TInt menuId);
	void ChangeScrollPos(TInt nPos);
	void OnInput(const TDesC8& strInput);

	TInt GetDataLength();
	TInt16 GetDataType();
	TBool ReadData(const TDesC8& aData);
	void WriteData(TDes8& aBuf);

private:
	void InitData();
	void InitSoftKey();
	void DrawTitle(CFbsBitGc& g) const;
	void DrawAddMode(CFbsBitGc& g) const;
	void HandleUpAndDownKeyEvent(TInt upOrdown);
	void HandleSaveMenuEvent();
	void CreateModifiedTips(TInt aOperation, TDes& aDes);
	TBool ReadSearchData(const TDesC8& aData);
	TBool ReadChangeZXGData(const TDesC8& aData);
	TBool ReadSynZXGData(const TDesC8& aData);
	void OnInput(const TDesC& strInput);
	
protected:
	void BeforeDraw(CFbsBitGc& g) const;

private:
	enum {UP, DOWN};
	enum {NORMALMODE, MOVEZXGMODE, DELZXGMODE, ADDZXGMODE, SYNZXGMODE};
	RArray<TBool> m_marked;
	RArray<TGoodsName> m_vZXG;
	RArray<TGoodsName>& m_modifiedZXG;
	TBuf<2> m_strCheck;
	TInt m_nCurrentItem;
	TInt m_curMode;
	TInt	m_nMovePos;
	TBool	m_bMoveStock;
	CSingleLineTextInput* m_input;
	TBuf8<6> m_InputString;
};

#endif // BLOCKZXGMANAGE_H
